Optimal. Leaf size=165 \[ -\left (\left (3 a^2 b B-b^3 B+a^3 C-3 a b^2 C\right ) x\right )-\frac {\left (a^3 B-3 a b^2 B-3 a^2 b C+b^3 C\right ) \log (\cos (c+d x))}{d}+\frac {b \left (a^2 B-b^2 B-2 a b C\right ) \tan (c+d x)}{d}+\frac {(a B-b C) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}+\frac {C (a+b \tan (c+d x))^4}{4 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 165, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3711, 3609,
3606, 3556} \begin {gather*} \frac {b \left (a^2 B-2 a b C-b^2 B\right ) \tan (c+d x)}{d}-\frac {\left (a^3 B-3 a^2 b C-3 a b^2 B+b^3 C\right ) \log (\cos (c+d x))}{d}-x \left (a^3 C+3 a^2 b B-3 a b^2 C-b^3 B\right )+\frac {(a B-b C) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}+\frac {C (a+b \tan (c+d x))^4}{4 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3711
Rubi steps
\begin {align*} \int (a+b \tan (c+d x))^3 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\frac {C (a+b \tan (c+d x))^4}{4 b d}+\int (a+b \tan (c+d x))^3 (-C+B \tan (c+d x)) \, dx\\ &=\frac {B (a+b \tan (c+d x))^3}{3 d}+\frac {C (a+b \tan (c+d x))^4}{4 b d}+\int (a+b \tan (c+d x))^2 (-b B-a C+(a B-b C) \tan (c+d x)) \, dx\\ &=\frac {(a B-b C) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}+\frac {C (a+b \tan (c+d x))^4}{4 b d}+\int (a+b \tan (c+d x)) \left (-2 a b B-a^2 C+b^2 C+\left (a^2 B-b^2 B-2 a b C\right ) \tan (c+d x)\right ) \, dx\\ &=-\left (3 a^2 b B-b^3 B+a^3 C-3 a b^2 C\right ) x+\frac {b \left (a^2 B-b^2 B-2 a b C\right ) \tan (c+d x)}{d}+\frac {(a B-b C) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}+\frac {C (a+b \tan (c+d x))^4}{4 b d}+\left (a^3 B-3 a b^2 B-3 a^2 b C+b^3 C\right ) \int \tan (c+d x) \, dx\\ &=-\left (3 a^2 b B-b^3 B+a^3 C-3 a b^2 C\right ) x-\frac {\left (a^3 B-3 a b^2 B-3 a^2 b C+b^3 C\right ) \log (\cos (c+d x))}{d}+\frac {b \left (a^2 B-b^2 B-2 a b C\right ) \tan (c+d x)}{d}+\frac {(a B-b C) (a+b \tan (c+d x))^2}{2 d}+\frac {B (a+b \tan (c+d x))^3}{3 d}+\frac {C (a+b \tan (c+d x))^4}{4 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.10, size = 209, normalized size = 1.27 \begin {gather*} \frac {-6 i (a+i b)^4 B \log (i-\tan (c+d x))+6 i (a-i b)^4 B \log (i+\tan (c+d x))-12 b^2 \left (-6 a^2+b^2\right ) B \tan (c+d x)+24 a b^3 B \tan ^2(c+d x)+4 b^4 B \tan ^3(c+d x)+3 C (a+b \tan (c+d x))^4-6 (a B+b C) \left ((i a-b)^3 \log (i-\tan (c+d x))-(i a+b)^3 \log (i+\tan (c+d x))+6 a b^2 \tan (c+d x)+b^3 \tan ^2(c+d x)\right )}{12 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.09, size = 213, normalized size = 1.29
method | result | size |
norman | \(\left (-3 B \,a^{2} b +B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) x +\frac {\left (3 B \,a^{2} b -B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {C \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}+\frac {b \left (3 B a b +3 C \,a^{2}-b^{2} C \right ) \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {b^{2} \left (B b +3 C a \right ) \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {\left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(180\) |
derivativedivides | \(\frac {\frac {C \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )}{4}+\frac {B \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+C a \,b^{2} \left (\tan ^{3}\left (d x +c \right )\right )+\frac {3 B a \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {3 C \,a^{2} b \left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {C \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 B \,a^{2} b \tan \left (d x +c \right )-B \,b^{3} \tan \left (d x +c \right )+C \,a^{3} \tan \left (d x +c \right )-3 C a \,b^{2} \tan \left (d x +c \right )+\frac {\left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-3 B \,a^{2} b +B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(213\) |
default | \(\frac {\frac {C \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )}{4}+\frac {B \,b^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+C a \,b^{2} \left (\tan ^{3}\left (d x +c \right )\right )+\frac {3 B a \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {3 C \,a^{2} b \left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {C \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+3 B \,a^{2} b \tan \left (d x +c \right )-B \,b^{3} \tan \left (d x +c \right )+C \,a^{3} \tan \left (d x +c \right )-3 C a \,b^{2} \tan \left (d x +c \right )+\frac {\left (B \,a^{3}-3 B a \,b^{2}-3 C \,a^{2} b +C \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-3 B \,a^{2} b +B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(213\) |
risch | \(\frac {2 i B \,a^{3} c}{d}-3 i B a \,b^{2} x +i B \,a^{3} x +\frac {2 i C \,b^{3} c}{d}-3 B \,a^{2} b x +B \,b^{3} x -C \,a^{3} x +3 C a \,b^{2} x +\frac {2 i \left (-12 C a \,b^{2}+3 C \,a^{3}+9 B \,a^{2} b -4 B \,b^{3}+27 B \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}+9 B \,a^{2} b \,{\mathrm e}^{6 i \left (d x +c \right )}+27 B \,a^{2} b \,{\mathrm e}^{4 i \left (d x +c \right )}-9 i C \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}-18 i C \,a^{2} b \,{\mathrm e}^{4 i \left (d x +c \right )}-9 i C \,a^{2} b \,{\mathrm e}^{6 i \left (d x +c \right )}-6 B \,b^{3} {\mathrm e}^{6 i \left (d x +c \right )}-10 B \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-12 B \,b^{3} {\mathrm e}^{4 i \left (d x +c \right )}-18 i B a \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-9 i B a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-9 i B a \,b^{2} {\mathrm e}^{6 i \left (d x +c \right )}-36 C a \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+6 i C \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-18 C a \,b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+6 i C \,b^{3} {\mathrm e}^{4 i \left (d x +c \right )}+6 i C \,b^{3} {\mathrm e}^{6 i \left (d x +c \right )}-30 C a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+3 C \,a^{3} {\mathrm e}^{6 i \left (d x +c \right )}+9 C \,a^{3} {\mathrm e}^{2 i \left (d x +c \right )}+9 C \,a^{3} {\mathrm e}^{4 i \left (d x +c \right )}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{4}}-3 i C \,a^{2} b x -\frac {6 i B a \,b^{2} c}{d}+i C \,b^{3} x -\frac {6 i C \,a^{2} b c}{d}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a \,b^{2}}{d}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C \,a^{2} b}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C \,b^{3}}{d}\) | \(579\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 179, normalized size = 1.08 \begin {gather*} \frac {3 \, C b^{3} \tan \left (d x + c\right )^{4} + 4 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \tan \left (d x + c\right )^{3} + 6 \, {\left (3 \, C a^{2} b + 3 \, B a b^{2} - C b^{3}\right )} \tan \left (d x + c\right )^{2} - 12 \, {\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} {\left (d x + c\right )} + 6 \, {\left (B a^{3} - 3 \, C a^{2} b - 3 \, B a b^{2} + C b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 12 \, {\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.13, size = 178, normalized size = 1.08 \begin {gather*} \frac {3 \, C b^{3} \tan \left (d x + c\right )^{4} + 4 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \tan \left (d x + c\right )^{3} - 12 \, {\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} d x + 6 \, {\left (3 \, C a^{2} b + 3 \, B a b^{2} - C b^{3}\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (B a^{3} - 3 \, C a^{2} b - 3 \, B a b^{2} + C b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 12 \, {\left (C a^{3} + 3 \, B a^{2} b - 3 \, C a b^{2} - B b^{3}\right )} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 313 vs.
\(2 (151) = 302\).
time = 0.16, size = 313, normalized size = 1.90 \begin {gather*} \begin {cases} \frac {B a^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 3 B a^{2} b x + \frac {3 B a^{2} b \tan {\left (c + d x \right )}}{d} - \frac {3 B a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {3 B a b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} + B b^{3} x + \frac {B b^{3} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {B b^{3} \tan {\left (c + d x \right )}}{d} - C a^{3} x + \frac {C a^{3} \tan {\left (c + d x \right )}}{d} - \frac {3 C a^{2} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {3 C a^{2} b \tan ^{2}{\left (c + d x \right )}}{2 d} + 3 C a b^{2} x + \frac {C a b^{2} \tan ^{3}{\left (c + d x \right )}}{d} - \frac {3 C a b^{2} \tan {\left (c + d x \right )}}{d} + \frac {C b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C b^{3} \tan ^{4}{\left (c + d x \right )}}{4 d} - \frac {C b^{3} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{3} \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2870 vs.
\(2 (159) = 318\).
time = 2.47, size = 2870, normalized size = 17.39 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.83, size = 181, normalized size = 1.10 \begin {gather*} x\,\left (-C\,a^3-3\,B\,a^2\,b+3\,C\,a\,b^2+B\,b^3\right )-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {C\,b^3}{2}-\frac {3\,a\,b\,\left (B\,b+C\,a\right )}{2}\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-C\,a^3-3\,B\,a^2\,b+3\,C\,a\,b^2+B\,b^3\right )}{d}+\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,a^3}{2}-\frac {3\,C\,a^2\,b}{2}-\frac {3\,B\,a\,b^2}{2}+\frac {C\,b^3}{2}\right )}{d}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {B\,b^3}{3}+C\,a\,b^2\right )}{d}+\frac {C\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^4}{4\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________